package com.ag.hmk.service.impl;

import java.util.List;

import com.ag.bean.TbAidgoodsku;
import com.ag.common.IDUtil;
import com.ag.hmk.dao.HmkAidGoodskuDAO;
import com.ag.hmk.service.AidGoodsKUService;

/**
 * 
 * @author 黄木看
 * 救援物资库服务接口实现
 *
 */
public class AidGoodskuServImpl implements AidGoodsKUService {

	private HmkAidGoodskuDAO hmkAidGoodskuDAO;
	
	/*
	 *删除一条记录 
	 */
	public void delete(TbAidgoodsku aidgoodsku) {
		if (aidgoodsku!=null) {
			aidgoodsku.setA(IDUtil.DELETE);
			hmkAidGoodskuDAO.attachDirty(aidgoodsku);
		}
		
	}

	/*
	 * 查询所有记录
	 */
	public List<TbAidgoodsku> findAll() {
		return hmkAidGoodskuDAO.findAll();
	}

	/*
	 * 查询一条记录（by id）
	 */
	public TbAidgoodsku findByID(String agkuID) {
		if (agkuID!=null) {
			return hmkAidGoodskuDAO.findById(agkuID);
		} else {
			return null;
		}
		
	}

	/*
	 * 新增或更新记录
	 */
	public void save(TbAidgoodsku aidgoodsku) {
		if (aidgoodsku!=null) {
			aidgoodsku.setA(IDUtil.PRESERVE);
			hmkAidGoodskuDAO.attachDirty(aidgoodsku);
		}
		
	}

	public void setHmkAidGoodskuDAO(HmkAidGoodskuDAO hmkAidGoodskuDAO) {
		this.hmkAidGoodskuDAO = hmkAidGoodskuDAO;
	}

}
